home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Click 1 (Special Issue) / fantasy.iso / Demo The Druid King / DemoMap.pak / SEQUENCES_S02_MAIN.VS < prev    next >
Text File  |  2001-04-11  |  5KB  |  220 lines

  1. // void
  2.  
  3. NamedObj Daranix, Keltill;
  4.  
  5. Daranix = GetNamedObj("Daranix");
  6. Keltill = GetNamedObj("Keltill");
  7.  
  8. // Where to place the item holder?
  9. // Item holder passability
  10.  
  11. /*************************************/
  12. /************* STUB CODE *************/
  13. /*************************************/
  14.  
  15. /*    ObjSet GaulArmy;
  16.  
  17.     cls();
  18.     PlayersShareView(1,3);
  19.  
  20.     View(point(1600,13000),false);
  21.  
  22. // spawn Keltill
  23.     Keltill = CreateNamedObj("Keltill", PlaceEx("Keltill", 2000, 12250, 1));
  24.  
  25. // spawn gaul army
  26.     PlaceBlockEx("GHorseman", 1, 2000, 12300, 12, 1, 50, 50, "GaulArmy");
  27.     PlaceBlockEx("GHorseman", 1, 2000, 12350, 12, 2, 50, 50, "GaulArmy");
  28.     GaulArmy = GetObjSet("GaulArmy");
  29.     GaulArmy.AddCommand(true,"attach", Keltill.obj);
  30.     GaulArmy.KillCommand();
  31.  
  32.     Daranix = CreateNamedObj("Daranix", PlaceEx("Daranix", 1600, 12500, 1));*/
  33.  
  34. /*************************************/
  35. /*********** STUB CODE END ***********/
  36. /*************************************/
  37.  
  38. PlayersShareView(1,4); // Player 4 is used to temporarily disallow control of some units
  39. PlayersAlly(1,4);
  40. PlayersAlly(1,6);    // Player 6 is used while Daranix and his army are outside the map, so they do not reveal the fog
  41.  
  42. // Place the item holder with the item in it
  43. {
  44.     ItemHolder holder;
  45.     holder = PlaceEx("DefItemHolder2", 1660, 14150, 8);
  46.     holder.CreateItem("box");
  47. }
  48.  
  49. // Give note and wait for completion
  50. EnvWriteString("/NewNote", 4);    // *** Prepare the army that will go to Ludgunum ***
  51. Run("CurrentMap/mission_notes.vs");
  52.  
  53. while (Daranix.obj.AsHero().army.Count()<35 || Daranix.obj.DistTo(Keltill.obj)>350) {
  54.     Sleep(500);
  55. }
  56.  
  57. // Trigger the conversation    and remove note
  58. {
  59.     Conversation c;
  60.     EnvWriteString("/DM C7/CalledFromSeq","2");
  61.     c.Init("DM C7", 2, 0);
  62.     c.Run();
  63. }
  64.  
  65. EnvWriteInt("/Note4", 0);
  66.  
  67. // Give note and wait for completion
  68. EnvWriteString("/NewNote", 10);    // *** Note: Go towards Ludgunum with Daranix and his army ***
  69. Run("CurrentMap/mission_notes.vs");
  70.  
  71. {
  72.     TRect rc;
  73.     rc.Set(709, 14489, 1629, 15981);
  74.  
  75.     while (Daranix.obj.AsHero().army.Count()<35 || !ptInRect(Daranix.obj.pos, rc)) {
  76.         Sleep(500);
  77.     }
  78. }
  79.  
  80. // Now let Daranix finish his journey
  81. ClearSelection();
  82.  
  83. {
  84.     ObjList army;
  85.     int i;
  86.  
  87.     Daranix.obj.SetPlayer(4);
  88.     army = Daranix.obj.AsHero().army;
  89.     for (i=0;i<army.Count();i+=1)
  90.         army[i].SetPlayer(4);
  91. }
  92.  
  93. Daranix.obj.AddCommand(true, "move", point(1000,16300));
  94. Daranix.obj.KillCommand();
  95.  
  96. while (Daranix.obj.script!="idle") {
  97.     Sleep(500);
  98. }
  99.  
  100. // Move him outside the map and remove the note
  101. {
  102.     ObjList army;
  103.     int i;
  104.     TPoint vector;
  105.  
  106.     vector.Set(0,460);
  107.  
  108.     if (Daranix.obj.pos.y+vector.y > 16360)
  109.         Daranix.obj.SetPos(point(Daranix.obj.pos.x, 16360));
  110.     else
  111.         Daranix.obj.SetPos(Daranix.obj.pos+vector);
  112.  
  113.     Daranix.obj.SetPlayer(6);
  114.     army = Daranix.obj.AsHero().army;
  115.     for (i=0;i<army.Count();i+=1)
  116.         {
  117.             if (army[i].pos.y+vector.y > 16360)
  118.                 { army[i].SetPos(point(army[i].pos.x, 16360)); }
  119.             else
  120.                 { army[i].SetPos(army[i].pos+vector); }
  121.             army[i].SetPlayer(6);
  122.         }
  123. }
  124.  
  125. EnvWriteInt("/Note10", 0);
  126.  
  127. //RunSequence("s04_main");
  128. Sleep(10000);
  129.  
  130. // Send back a messenger
  131.  
  132. {
  133.     Unit messenger;
  134.     Conversation c;
  135.  
  136.     messenger = PlaceEx("GaulMessenger1", 1100, 15950, 4).AsUnit();
  137.     messenger.ClearCommands();
  138.     messenger.AddCommand(true, "approach", Keltill.obj);
  139.     messenger.KillCommand();
  140.  
  141.     while (messenger.script!="idle") {
  142.         Sleep(500);
  143.     }
  144.  
  145.     c.Init("DM C8", 2, 0);
  146.     c.SetActor("Messenger", messenger, "");
  147.     c.Run();
  148.  
  149.     messenger.SetPlayer(1);
  150.     messenger.AddCommand(true, "move", messenger.pos+point(100,-200));
  151.     messenger.KillCommand();
  152. }
  153.  
  154. Sleep(10000);
  155.  
  156. // Send back the reduced Daranix army
  157.  
  158. {
  159.     ObjList army;
  160.     int i, to_kill;
  161.  
  162.     // Black magic: Kill each other unit from the Daranix army
  163.     to_kill = Daranix.obj.AsHero().army.Count()/2;
  164.     for (i=0;i<to_kill;i+=1)
  165.         Daranix.obj.AsHero().army[i].Kill();
  166.     // Reduce some health from the other
  167.     army = Daranix.obj.AsHero().army;
  168.     for (i=0;i<army.Count();i+=1)
  169.         army[i].Damage(rand(army[i].health/2));
  170.  
  171.     // Move him back on the map
  172.     {
  173.         ObjList army;
  174.         int i;
  175.         TPoint vector;
  176.  
  177.         vector.Set(0,-460);
  178.  
  179.         Daranix.obj.SetPos(Daranix.obj.pos+vector);
  180.         Daranix.obj.SetPlayer(4);
  181.         army = Daranix.obj.AsHero().army;
  182.         for (i=0;i<army.Count();i+=1)
  183.             {
  184.                 army[i].SetPos(army[i].pos+vector);
  185.                 army[i].SetPlayer(4);
  186.             }
  187.         for (i=0;i<army.Count();i+=1)
  188.             if (army[i].OnImpassable())
  189.                 army[i].Delete();
  190.     }
  191.  
  192.     Daranix.obj.ClearCommands();
  193.     Daranix.obj.AddCommand(true, "approach", Keltill.obj);
  194.     Daranix.obj.KillCommand();
  195.  
  196.     while (Daranix.obj.script!="idle") {
  197.         Sleep(500);
  198.     }
  199.  
  200.     army = Daranix.obj.AsHero().army;
  201.     Daranix.obj.SetPlayer(1);
  202.     for (i=0;i<army.Count();i+=1)
  203.         army[i].SetPlayer(1);
  204. }
  205.  
  206.  
  207. while (1) {
  208.     // TODO: Maybe check for this in the last delay cycle
  209.     if (Daranix.obj.DistTo(Keltill.obj)<Daranix.obj.sight+200)
  210.         {
  211.             Conversation c;
  212.             c.Init("DM C9", 2, 0);
  213.             c.Run();
  214.             break;
  215.         }
  216.     Sleep(1000);
  217. }
  218.  
  219. // Run sequence 4
  220. RunSequence("s04");